package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchReportFormsConfig;
import com.ruoyi.system.service.IDispatchReportFormsConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 报设置Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchReportFormsConfig")
public class DispatchReportFormsConfigController extends BaseController
{
    @Autowired
    private IDispatchReportFormsConfigService dispatchReportFormsConfigService;

    /**
     * 查询报设置列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportFormsConfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchReportFormsConfig dispatchReportFormsConfig)
    {
        startPage();
        List<DispatchReportFormsConfig> list = dispatchReportFormsConfigService.selectDispatchReportFormsConfigList(dispatchReportFormsConfig);
        return getDataTable(list);
    }

    /**
     * 导出报设置列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportFormsConfig:export')")
    @Log(title = "报设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchReportFormsConfig dispatchReportFormsConfig)
    {
        List<DispatchReportFormsConfig> list = dispatchReportFormsConfigService.selectDispatchReportFormsConfigList(dispatchReportFormsConfig);
        ExcelUtil<DispatchReportFormsConfig> util = new ExcelUtil<DispatchReportFormsConfig>(DispatchReportFormsConfig.class);
        util.exportExcel(response, list, "报设置数据");
    }

    /**
     * 获取报设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportFormsConfig:query')")
    @GetMapping(value = "/{reportFormsConfigId}")
    public AjaxResult getInfo(@PathVariable("reportFormsConfigId") Long reportFormsConfigId)
    {
        return success(dispatchReportFormsConfigService.selectDispatchReportFormsConfigByReportFormsConfigId(reportFormsConfigId));
    }

    /**
     * 新增报设置
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportFormsConfig:add')")
    @Log(title = "报设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchReportFormsConfig dispatchReportFormsConfig)
    {
        return toAjax(dispatchReportFormsConfigService.insertDispatchReportFormsConfig(dispatchReportFormsConfig));
    }

    /**
     * 修改报设置
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportFormsConfig:edit')")
    @Log(title = "报设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchReportFormsConfig dispatchReportFormsConfig)
    {
        return toAjax(dispatchReportFormsConfigService.updateDispatchReportFormsConfig(dispatchReportFormsConfig));
    }

    /**
     * 删除报设置
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchReportFormsConfig:remove')")
    @Log(title = "报设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reportFormsConfigIds}")
    public AjaxResult remove(@PathVariable Long[] reportFormsConfigIds)
    {
        return toAjax(dispatchReportFormsConfigService.deleteDispatchReportFormsConfigByReportFormsConfigIds(reportFormsConfigIds));
    }
}
